package com.ganbo.stock.repository;

import com.ganbo.stock.dto.FundStockLastDTO;
import com.ganbo.stock.entity.FundStock;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface FundStockRepository extends JpaRepository<FundStock, Long> {


    @Query("SELECT new com.ganbo.stock.dto.FundStockLastDTO(o.name,o.code,o.xqUrl,sum(1),o.currentPrice)  FROM FundStock o group by o.code ")
    List<FundStockLastDTO> findFundStockLast();

    List<FundStock> findFundStockByCode(String code);

}
